Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Collections.​Generic.​SortedDictionary<​TKey, TValue>

Assembly: System.Collections

Inheritance: object → SortedDictionary

Implemented Interfaces

Represents a collection of key/value pairs that are sorted on the key.

Properties

public IComparer<​TKey>
Comparer
Gets the <see cref="T:System.Collections.Generic.IComparer`1" /> used to order the elements of the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> .
public int
Count
Gets the number of key/value pairs contained in the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> .
public TValue
Item
public KeyCollection<​TKey, TValue>
Keys
Gets a collection containing the keys in the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> .
public ValueCollection<​TKey, TValue>
Values
Gets a collection containing the values in the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> .

Methods

public void
Add​(TKey key, TValue value)
Adds an element with the specified key and value into the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> .
key The key of the element to add.
value The value of the element to add. The value can be <see langword="null" /> for reference types.
public void
Clear​()
Removes all elements from the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> .
public bool
ContainsKey​(TKey key)
Determines whether the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> contains an element with the specified key.
Returns <see langword="true" /> if the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> contains an element with the specified key; otherwise, <see langword="false" /> .
key The key to locate in the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> .
public bool
ContainsValue​(TValue value)
Determines whether the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> contains an element with the specified value.
Returns <see langword="true" /> if the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> contains an element with the specified value; otherwise, <see langword="false" /> .
value The value to locate in the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> . The value can be <see langword="null" /> for reference types.
public void
CopyTo​(KeyValuePair[] array, int index)
Copies the elements of the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> to the specified array of <see cref="T:System.Collections.Generic.KeyValuePair`2" /> structures, starting at the specified index.
array The one-dimensional array of <see cref="T:System.Collections.Generic.KeyValuePair`2" /> structures that is the destination of the elements copied from the current <see cref="T:System.Collections.Generic.SortedDictionary`2" /> The array must have zero-based indexing.
index The zero-based index in <paramref name="array" /> at which copying begins.
public Enumerator<​TKey, TValue>
GetEnumerator​()
Returns an enumerator that iterates through the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> .
Returns A <see cref="T:System.Collections.Generic.SortedDictionary`2.Enumerator" /> for the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> .
public bool
Remove​(TKey key)
Removes the element with the specified key from the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> .
Returns <see langword="true" /> if the element is successfully removed; otherwise, <see langword="false" /> . This method also returns <see langword="false" /> if <paramref name="key" /> is not found in the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> .
key The key of the element to remove.
public bool
TryGetValue​(TKey key, TValue& value)
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object